package com.anpxd.erpad.net

import com.anpxd.erpad.App
import com.gg.net.ApiFactory

/**
 * Creator : GG
 * Date    : 2018/3/2
 * Mail    : gg.jin.yu@gmai.com
 * Explain :
 */
object ApiFactory : ApiFactory() {

    private var erpApi: ErpApi? = null
    private var wxApi: WxApi? = null


    fun getErpApi(): ErpApi {
        if (erpApi == null)
            erpApi = mRetrofitBuilder.baseUrl(App.instance.getErpUrl()).build().create(ErpApi::class.java)

        return erpApi
                ?: mRetrofitBuilder.baseUrl(App.instance.getErpUrl()).build().create(ErpApi::class.java)
    }

    fun getWxApi(): WxApi {
        if (wxApi == null)
            wxApi = mRetrofitBuilder.baseUrl(App.instance.getWxUrl()).build().create(WxApi::class.java)

        return wxApi
                ?: mRetrofitBuilder.baseUrl(App.instance.getWxUrl()).build().create(WxApi::class.java)
    }

}